package com.amazon.trietree.main;

import com.amazon.trietree.server.MetaDataLocalServer;
import com.amazon.trietree.server.MetaDataStructMonitor;
import com.amazon.trietree.zkStub.CuratorClientStub;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * Created with IntelliJ IDEA.
 * User: Tylaar
 * Date: 11/7/12
 * Time: 10:56 PM
 * Company: Amazon.com
 */
public class MainPoint {
    public static void main(String[] args)throws Exception{
        //ApplicationContext applicationContext = new FileSystemXmlApplicationContext("C:\\Users\\Tylaar\\IdeaProjects\\TrieTreeTestBench\\src\\spring-config.xml");
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-config.xml");
        //MetaDataLocalServer localServer = (MetaDataLocalServer)applicationContext.getBean("fingerPrintStructureServer");
        //localServer.addAllFingerPprintsFromIO();
        //MetaDataStructMonitor monitor = (MetaDataStructMonitor)applicationContext.getBean("fingerPrintServerMonitor");
        //monitor.printStatisticReport();
        CuratorClientStub stub = (CuratorClientStub)applicationContext.getBean("curatorClientStub");
        stub.competeForMaster();
        System.out.println("Press enter/return to quit\n");
        new BufferedReader(new InputStreamReader(System.in)).readLine();
    }
}
